#ifndef DIRECTORY_H
#define DIRECTORY_H

#define DIR_TYPE_DIR 0
#define DIR_TYPE_FILE 1
#define IS_DIR(dir) ((dir) == DIR_TYPE_DIR)
#define NAME_LEN_MAX 256

#define DIR_X 20
#define DIR_Y 30
#define DIR_COLOR (rgb2col(0,100,0))
#define DIR_SIZE 1
#define DIR_HEIGHT 15

#define INIT_DIR ("ms0:/")

unsigned char curfilepath[NAME_LEN_MAX];
unsigned char savefilepath[NAME_LEN_MAX];
unsigned char savefilename[NAME_LEN_MAX];
typedef struct 
{
	unsigned char dirname[NAME_LEN_MAX];
	int dirmode;
	int dirtimeday;
	int dirtimesec;
	int dirsize;
} Dirlist;//* dirlist = NULL;

unsigned char* filebuffer;
int filebuffersize;
Dirlist * dirlist;
int dirlist_size;
int dir_selected;


void build_path(unsigned char *output, const unsigned char *root, const unsigned char *path, int append);

void InitDirectory();

int DrawDirectory(unsigned char* filepath);

int UpdateDirectory(unsigned char* filepath, int save);

int opendirectory(unsigned char* filepath, const unsigned char *location, const unsigned char *directoryname);


#endif
